/**
 * 生成 guid
 * @returns {string}
 */
export function guid() {
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
    var r = Math.random() * 16 | 0;
    var v = c === 'x' ? r : (r & 0x3 | 0x8);
    return v.toString(16);
  });
}

/**
 * 区间随机数
 * @param istart
 * @param iend
 * @param round // 整数
 * @returns {number}
 */
export function getRandom(istart, iend, round = false) {
  let iChoice = iend - istart
  let num = Math.random() * iChoice + istart
  if (round) {
    return Math.round(num)
  } else {
    return num
  }
}
